define m = Character("我",image="maleplayer")
define fm = Character("贝贝",image="beibei")
image dorm :
    "dorm.png"
    xsize 1280
    ysize 720
image schoolgate :
    'schoolgate.png'
image dormnight :
    "dorm night.png"
init python:
    import random
    power = 180
    maxpower = 180
    knowledge = 100
    popularity= 0
    foreign = 0
    appearance = int(200*random.random())
    rank = 80 #加权
    lefttime = 24 #每日剩余时间
    total = 0 #总天数
    lizhi = 100
    grade = 0
    season = 0
    date = 1
    homework = 0
    loverate = 0
    inlove = 0
    guake = 0
    timeforher = 0
    lovedate = 0
    # style.button['学习'].background = "#f00"
    # style.button['锻炼'].background = "#00f"
    style.text['power'].color  = '#22B14C'
    style.text['lefttime'].color  = '#E43B36'
    style.text['homework'].color  = '#00A2E8'
    style.text['appearance'].color  = '#3F48CC'
    style.text['rank'].color  = '#E43B36'
    style.text['lizhi'].color  = '#A349A4'
    style.text['account'].color  = '#000000'
screen indexed_style_test:
    hbox:
        spacing 900
        ypos 25
        xpos 25
        hbox xalign 0.0:
            vbox  xalign 0.0:
                imagebutton auto "account_%s.png" action None
            vbox:
                spacing gui.navigation_spacing
                if grade == 0:
                    label "大一" style style.text['account']
                elif grade == 1:
                    label "大二" style style.text['account']
                elif grade == 2:
                    label "大三" style style.text['account']
                else:
                    label "大四" style style.text['account']
                if season % 2:
                    label "下学期" style style.text['account'] #学期
                else:
                    label "上学期" style style.text['account']
                $ date = total - season * 12 + 1
                label "第[date]天" style style.text['account'] #天

        vbox:
            spacing 60
            hbox:
                vbox:
                    spacing gui.navigation_spacing
                    label "体力: [power]/[maxpower]" style style.text['power']
                    label "时间: [lefttime]/24" style style.text['lefttime']
                    $ process = int(homework * 100 / 8)
                    label "作业: [process]%" style style.text['homework']
                    label "颜值: [appearance]" style style.text['appearance']
                    label "加权: [rank]" style style.text['rank']
                    label "理智: [lizhi]" style style.text['lizhi']
            vbox:
                textbutton "学习: 2小时 10体力" style style.button["学习"] action [Play("sound", "click.mp3"), Call("study")]
                textbutton "打游戏" style style.button["打游戏"] action [Play("sound", "click.mp3"), Call("game")]
                textbutton "睡觉" style style.button["睡觉"] action [Play("sound", "click.mp3"), Call("sleep")]
                textbutton "写作业" style style.button["写作业"] action [Play("sound", "click.mp3"), Call("dohomework")]
                if inlove:
                    textbutton "和女朋友约会: 3小时 体力-30" style style.button["约会"] action [Play("sound", "click.mp3"), Call("dateher")]
                if total == 8:
                    textbutton "学科竞赛 12小时 体力-50" style style.button["竞赛"] action [Play("sound", "click.mp3"), Call("complete")]

label start:
    show ruxuexuzhi
    "入学须知，请认真阅读"
    pause
    hide ruxuexuzhi
    show schoolgate
    m happy "今天是2017年9月1日 我考入了华中科技大学,今天是我入学的日子！"
    m happy "我一定要好好学习，将来成为一个有用的人。"
    hide schoolgate
    show dorm
    m "这里就是我的寝室了，我将会在这里度过四年大学时光。"
    hide dorm

label dorm: #主要活动场所
    play music "audio/opening.mp3" fadeout 1.0 fadein 1.0
    python:
        fenshouflag = 0
        if total-lovedate>5 and date== 0:
            seed = random.random()
            if timeforher<10:
                if seed<0.7:
                    fenshouflag =1
            if timeforher>=10 and timeforher <15:
                if seed <0.3:
                    fenshouflag = 1
        if lefttime == 0:
            print 111111111111111
            total = total + 1
            season = int(total / 12)
            grade = int(season / 2)
            date = total - season * 12 + 1
            lefttime = 24
            renpy.jump("haveclass")
        if total > 0 and total%3 == 0:
            if homework<8:
                rank-=2
                renpy.notify("作业没完成，加权降低了")
            else:
                rank+=1
                renpy.notify("作业完成了，又有新的作业布置下来啦!")
            homework = 0
        loveflag = 0
        if inlove == 0: #恋爱判定
            loverate = random.random()
            if appearance <100 and appearance >50:
                if loverate <0.006:
                    loveflag = 1
            elif appearance <150 and appearance >100:
                if loverate <0.01:
                    loveflag = 1
            elif appearance >150:
                if loverate <0.02:
                    loveflag = 1
    if date == 11 or date == 12:
        jump exam
    if lizhi<=10:
        jump ending8zisha
    if power<=10:
        jump ending7die
    if fenshouflag :
        $fenshouflag = 0;
        jump fenshou
    if guake>3 :
        "你挂科太多了，本升专，大专人大专魂，大专都是人上人！"
        jump ending6tuixue
    if loveflag == 1:
        $print loveflag
        $loveflag = 0
        jump love
    show screen indexed_style_test
    show dorm
    show yemian
    m "今天要做什么呢？"
    if total >= 96:
        jump graduate
    "请选择今天的安排"
    jump dorm
label haveclass:
    "今天要上6小时的课程，是否翘课？"
    menu :
        "是的，我要翘课":
            "你选择翘课 返回寝室"
            $ signed = random.random()
            if signed <0.3:
                "很不幸，老师今天点名，发现你翘课了，你将会受到惩罚"
                $rank -=5
                call screen confirm("加权-5", Jump("dorm"), None)
            else:
                "很幸运，老师今天没有点名，你成功翘课了"
                jump dorm
        "不，我不翘课":
            "你选择不翘课"
            show classroom
            m "上了一天课，累死啦"
            $ lefttime -=6
            $ power -= 40
            $ rank += 1
            hide classroom
            call screen confirm("剩余时间-6 体力-40 加权+1", Jump("dorm"), None)
label fenshou:
    hide yemian
    hide screen indexed_style_test
    show datingcry
    $lizhi -= 30
    hide datingcry
    call screen confirm("理智-30", Jump("dorm"), None)

label love:
    $print loveflag
    hide yemian
    hide screen indexed_style_test
    play music "audio/love.mp3"
    show lovescence
    "有个女生约你到青年园见面"
    fm "我喜欢你!和我在一起吧!!"
    menu:
        "同意":
            m "好啊，我们在一起吧！"
            "你的过去我来不及参与，你的未来我奉陪到底！恭喜你，你交到了女朋友，解锁了新的事件"
            $inlove = 1
            $lovedate = date
            hide lovescence
            jump dorm
        "不同意":
            m "对不起，比起你，我更爱学习。"
            hide lovescence
            show datingcry
            $inloRve = 0
            jump dorm
label dateher:
    hide yemian
    hide screen indexed_style_test
    hide dorm
    if lefttime > 2 and power > 10:
        python:
            power = power - 10
            lefttime -=2
            rank +=2
        play music "audio/date.mp3"
        "你和你的女朋友约会，你们手牵着手，一同走过华中科技大学的一条条街道"
        m "我好喜欢你呀"
        fm "我也好喜欢你呀"
        "你和你可爱的女朋友度过了甜蜜的一天 你的理智提高了30"
        call screen confirm("理智+30 体力-20 时间-3", Jump("dorm"), None)
    else:
        "体力或时间不足！"
    hide lovescence
    jump dorm

label study:
    hide yemian
    hide screen indexed_style_test
    play music "audio/sleep.mp3"
    if lefttime > 2 and power > 10:
        python:
            power = power - 25
            lefttime -=2
            rank +=2
        with fade
        show library
        m study "今天在图书馆努力学习了！"
        hide library
        call screen confirm("加权+1 体力-25 时间-2", Jump("dorm"), None)

    else:
        $renpy.notify("体力或时间不足！")
    # 学习增益及削弱
    jump dorm
label English:
    hide yemian
    hide screen indexed_style_test
    if lefttime > 2 and power > 20:
        python:
            power = power - 20
            lefttime -=2
        with fade
        show library
        m study "嚎啊油? 艾母five,三克斯，俺的油"
        $ foreign +=1
        call screen confirm("体力-20 时间-2 英语水平+1", Jump("dorm"), None)
        hide library
    else:
        $renpy.notify("体力或时间不足！")
label exercise:
    hide yemian
    hide screen indexed_style_test
    with fade
    show playground
    menu :
        "打篮球 1小时 20体力":
            jump basketball
        "羽毛球 1小时 10体力" :
            jump badminton
        "跑步 1小时 15体力":
            jump run
        "取消":
            hide playground
            jump dorm
    m "锻炼累死我了！"
    hide playground
    jump dorm
label game:
    hide yemian
    hide screen indexed_style_test

    if lefttime > 2 and power > 5:
        play music "/audio/sport.mp3"
        show steam
        "浏览游戏"
        hide steam
        show playgame
        python:
            power -=5
            lefttime -=2
            lizhi +=2
        "打游戏 杀疯了"
        hide playgame
        if random.random()<0.1:
            $popularity +=5
            call screen confirm("你的技术为你赢得了声望+5", Jump("dorm"), None)
        jump dorm
    else:
        $renpy.notify("体力或时间不足！")
        jump dorm

label exam: #自动触发
    hide yemian
    hide screen indexed_style_test
    show classroom
    m "今天要考试了！"
    ## 考试逻辑
    $rate = random.random()
    $up = 0
    if lizhi<=80 :
        "你感觉你这次考试要完犊子，是否选择作弊？"
        menu :
            "作弊":
                $catch = random.random()
                if catch<0.3:
                    "很不幸，你作弊被抓了！"
                    "因为作弊，你将会被退学处理"
                    $ up = 0.1
                    hide classroom
                    jump ending6tuixue
            "但是我拒绝":
                "你意志坚定，品格高尚，决定笑对死亡。"
                $ up =0
    if rank<=80 and rank>60:
        if rate<0.1 - up:
            $guake += 1
            "你能做的，岂止如此 你挂科了！"
            $lefttime = 0
            hide classroom
            call screen confirm("挂科+1", Jump("dorm"), None)
    elif rank<=60 and rank>40:
        if rate<0.2 - up:
            $guake += 1
            "你能做的，岂止如此，你挂科了！"
            $lefttime = 0
            hide classroom
            call screen confirm("挂科+1", Jump("dorm"), None)
    elif rank<=40:
        if rate<0.3 - up:
            $guake += 1
            "你能做的，岂止如此，你挂科了！"
            $lefttime = 0
            hide classroom
            call screen confirm("挂科+1", Jump("dorm"), None)
    "恭喜通过考试"
    $lefttime = 0
    hide classroom
    python:
        power -= 40
        lizhi -= 5
    call screen confirm("体力-40，理智-5 进入下一天", Jump("dorm"), None)
label dohomework:
    hide yemian
    hide screen indexed_style_test
    if homework >= 8:
        $renpy.notify("作业已经做完啦！")
        $rank +=1
        call screen confirm("加权+1", Jump("dorm"), None)
    m "写作业咯！"
    if lefttime > 2 and power > 30:
        python:
            power -=30
            lefttime -=2
            homework +=2
    else:
        $renpy.notify("体力或时间不足！")
    jump dorm

label sleep:
    hide yemian
    hide screen indexed_style_test
    play music "audio/sleep.mp3"
    python:
        power = power + maxpower * lefttime / 8
        power = int(power)
        if power > maxpower:
            power = maxpower
        lefttime = 0
    show dormnight
    m "睡觉了，晚安。"
    hide dormnight
    jump dorm
label basketball:
    "打篮球 球篮暴扣"
    hide yemian
    hide screen indexed_style_test
    if lefttime > 1 and power > 20:
        play music "audio/sport.mp3"
        python:
            power = power - 20
            lefttime -=1
            lizhi +=10
            appearance +=1
        hide playground
        call screen confirm("理智+10 体力-20 时间-1 颜值+1", Jump("dorm"), None)
    else:
        $renpy.notify("体力或时间不足！")
    jump dorm
label badminton:
    hide yemian
    hide screen indexed_style_test
    if lefttime > 1 and power > 10:
        play music "audio/sport.mp3"
        python:
            power = power - 10
            lefttime -=1
            lizhi +=1
            appearance +=1
        "打羽毛球 全力扣杀"
        hide playground
        call screen confirm("理智+10 体力-10 时间-1 颜值+1", Jump("dorm"), None)
    else:
        $renpy.notify("体力或时间不足！")
    jump dorm
label run:
    hide yemian
    hide screen indexed_style_test
    $ pig = random.random()
    if pig< 0.1:
        jump pigevent
    if lefttime > 1 and power > 15:
        play music "audio/sport.mp3"
        python:
            power = power - 15
            lefttime -=1
            lizhi +=1
            appearance +=1
        "跑步 挥汗如雨"
        hide playground
        call screen confirm("理智+10 体力-15 时间-1 颜值+1", Jump("dorm"), None)
    else:
        $renpy.notify("体力或时间不足！")
    jump dorm

label complete:
    "你选择参加竞赛,此竞赛将有可能让你获得保研资格"
    "首先是找队友，你要找什么样子的队友"
    $ seed2 = random.random()
    $ seed3 = random.random()
    show competition
    menu :
        "大牛队友带飞":
            if seed2 < 0.2:
                $popularity += 20
                if seed3 <0.05:
                    "恭喜你被国家队选中，获得保研资格！"
                    jump ending1baoyan
                    hide competition
                hide competition
                call screen confirm("获奖", Jump("dorm"), None)
            else:
                "很遗憾没获奖,再接再厉"
                hide competition
                jump dorm
        "旗鼓相当的队友":
            if seed2 < 0.2:
                $popularity += 20
                if seed3 <0.05:
                    "恭喜你被国家队选中，获得保研资格！"
                    hide competition
                    jump ending1baoyan
                hide competition
                call screen confirm("获奖", Jump("dorm"), None)
            else:
                "很遗憾没获奖,再接再厉"
                hide competition
                jump dorm
        "只会嘤嘤嘤的妹妹":
            if seed2 < 0.2:
                hide competition
                $popularity += 20
                if seed3 <0.05:
                    "恭喜你被国家队选中，获得保研资格！"
                    hide competition
                    jump ending1baoyan
                hide competition
                call screen confirm("获奖", Jump("dorm"), None)
            else:
                "很遗憾没获奖,再接再厉"
                hide competition
                jump dorm
label pigevent:
    show meetwildpig
    play music "audio/fightwithpig"
    "糟糕，前面有一只野猪，把一个女孩子逼到了墙角，这个时候你选择?"
    menu :
        "野猪没发现我，默默离开":
            jump dorm
        "想办法引开野猪，救下女孩":
            m "英勇地闪过，救下了这位美丽的女孩，围观群众惊呆了。"
            $ power = maxpower
            $ popularity += 30
            $ lizhi = 100
            call screen confirm("声望+30，理智点数恢复满格，体力满格", Jump("dorm"), None)

label graduate:
    if rank >=90:
        "你要毕业了，你的加权足够保研和出国，之后打算怎么办？"
        menu :
            "保研":
                jump ending1baoyan
            "出国":
                if foreign >= 10:
                    jump ending2chuguo
                else:
                    "外语水平不够 出国失败了...理智降低"
                    $lizhi -=30
                    jump graduate
            "就业":
                jump ending4work
            "创业":
                if popularity>=60:
                    "你凭借大学中丰富的社交活动，积攒了巨大声望，建立了创业公司！"
                    jump ending5create
                else:
                    "你缺乏人格魅力，没人帮你干活，创业夭折了...理智降低"
                    $lizhi -=30
                    jump graduate
    else:
        "你要毕业了，显然，你的加权并不足以保研，之后打算怎么办？"
        menu :
            "考研":
                jump ending3kaoyan
            "就业":
                if lizhi>=70 and popularity >30:
                    jump ending4work
                else:
                    "很不幸，你没找到工作，就业失败了...理智降低"
                    $lizhi -=30
                    jump graduate
            "创业":
                if popularity>=60:
                    "你凭借大学中丰富的社交活动，积攒了巨大声望，建立了创业公司"
                    jump ending5create
                else:
                    "你缺乏人格魅力，没人帮你干活，创业夭折了...理智降低"
                    $lizhi -=30
                    jump graduate
            "出国":
                if foreign >= 10:
                    jump ending2chugu
                else:
                    "外语水平不够，出国失败了...理智降低"
                    $lizhi -=30
                    jump graduate
label ending1baoyan:
    "手不释卷，老北京鸡肉卷，卷中之卷"
    show endingbaoyan
    "游戏结束~感谢您的游玩"
    "程序开发 华中科技大学 种子1701 吴亚军 曾德巍"
    "美术设计 华中科技大学 传播1901 贝佳丽"
    "产品经理 华中科技大学 传播1901 陈灵"
    jump end
label ending2chuguo:
    "成功出国留学"
    show endingchuguo
    "游戏结束~感谢您的游玩"
    "程序开发 华中科技大学 种子1701 吴亚军 曾德巍"
    "美术设计 华中科技大学 传播1901 贝佳丽"
    "产品经理 华中科技大学 传播1901 陈灵"
    jump end
label ending3kaoyan:
    "不是想考研，只是没人要。"
    show endingkaoyan
    "游戏结束~感谢您的游玩"
    "程序开发 华中科技大学 种子1701 吴亚军 曾德巍"
    "美术设计 华中科技大学 传播1901 贝佳丽"
    "产品经理 华中科技大学 传播1901 陈灵"
    jump end
label ending4work:
    "成功找到工作，全世界无产阶级，联合起来！"
    show endingwork
    "游戏结束~感谢您的游玩"
    "程序开发 华中科技大学 种子1701 吴亚军 曾德巍"
    "美术设计 华中科技大学 传播1901 贝佳丽"
    "产品经理 华中科技大学 传播1901 陈灵"
    jump end
label ending5create:
    show endingcreate
    "游戏结束~感谢您的游玩"
    "程序开发 华中科技大学 种子1701 吴亚军 曾德巍"
    "美术设计 华中科技大学 传播1901 贝佳丽"
    "产品经理 华中科技大学 传播1901 陈灵"
    jump end
label ending6tuixue:
    show endingtuixue
    "游戏结束~感谢您的游玩"
    "程序开发 华中科技大学 种子1701 吴亚军 曾德巍"
    "美术设计 华中科技大学 传播1901 贝佳丽"
    "产品经理 华中科技大学 传播1901 陈灵"
    jump end
label ending7die:
    "你因为长期熬夜得不到休息，终于体力不支晕了过去"
    play music "audio/120.mp3"
    show kuaisile
    "经过抢救你的结局是..."
    $die = random.random()
    if die <0.5:
        "你被抢救过来了，你回到了学校，但大病初愈，体力上限减半"
        $maxpower = int(maxpower/2)
        $power = maxpower
        jump dorm
    else:
        "很不幸，你死了,下辈子请注意身体健康哦~"
        show endingdie
    "游戏结束~感谢您的游玩"
    "程序开发 华中科技大学 种子1701 吴亚军 曾德巍"
    "美术设计 华中科技大学 传播1901 贝佳丽"
    "产品经理 华中科技大学 传播1901 陈灵"
    jump end
label ending8zisha:
    $zhili = random.random()
    if zhili <0.5:
        "失去理智的你万念俱灰，东九一跃解千愁"
        show selfdie
    else:
        jump dorm
    "游戏结束~感谢您的游玩"
    "程序开发 华中科技大学 种子1701 吴亚军 曾德巍"
    "美术设计 华中科技大学 传播1901 贝佳丽"
    "产品经理 华中科技大学 传播1901 陈灵"
    jump end
label end:
     $renpy.quit_event()
